package com.example.loki.griddemo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

/**
 * Created by ZR112916 on 2018/1/22.
 */

public class MyHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

    public TextView mTvText;
    public ImageView mIvBig;
    public ImageView mIvLeftTop;
    public ImageView mIvRightBottom;
    private Context mContext;

    public MyHolder(View itemView,Context context) {
        super(itemView);
        this.mContext = context;
        initView(itemView);
        mIvBig.setOnClickListener(this);// 可以对控件做点击事件
    }

    private void initView(View itemView) {
        mTvText = (TextView) itemView.findViewById(R.id.tv_text);
        mIvBig = (ImageView) itemView.findViewById(R.id.iv_big);
        mIvLeftTop = (ImageView) itemView.findViewById(R.id.iv_left_top);
        mIvRightBottom = (ImageView) itemView.findViewById(R.id.iv_right_bottom);
    }

    @Override
    public void onClick(View v) {
        Toast.makeText(mContext,mTvText.getText().toString(),Toast.LENGTH_LONG).show();
    }
}
